# tokens = ["2","1","+","3","*"]
# tokens = ["4","13","5","/","+"]
tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]
def evalRPN(tokens):
    #做一个栈
    stock=[]
    for item in tokens:
        if item=='+':
            num1=stock.pop()
            num2=stock.pop()
            stock.append(int(num1)+int(num2))
        elif item=='-':
            num1=stock.pop()
            num2=stock.pop()
            stock.append(int(num2)-int(num1))
        elif item=="*":
            num1=stock.pop()
            num2=stock.pop()
            stock.append(int(num1)*int(num2))
            pass
        elif item=="/":
            num1=stock.pop()
            num2=stock.pop()
            stock.append(int(int(num2)/int(num1)))
        else:
            #数字：入栈
            stock.append(item)
    print(stock[0])
evalRPN(tokens)
